﻿@using Microsoft.AspNetCore.Components.Authorization

<CascadingAuthenticationState>
    <Router AppAssembly="typeof(Program).Assembly" AdditionalAssemblies="new[] { typeof(Client._Imports).Assembly }">
        <Found Context="routeData">
            <AuthorizeRouteView RouteData="@routeData" DefaultLayout="typeof(Layout.MainLayout)">
                <NotAuthorized>
                    <MudContainer MaxWidth="MaxWidth.Small" Class="my-4">
                        <MudAlert Severity="Severity.Error">您无权访问此页面，请先登录。</MudAlert>
                        <MudButton Variant="Variant.Filled" Color="Color.Primary" Link="/login" Class="mt-2">
                            前往登录
                        </MudButton>
                    </MudContainer>
                </NotAuthorized>
            </AuthorizeRouteView>
            <FocusOnNavigate RouteData="routeData" Selector="h1"/>
        </Found>
        <NotFound>
            <PageTitle>Not found</PageTitle>
            <LayoutView Layout="typeof(Layout.MainLayout)">
                <p role="alert">Sorry, there's nothing at this address.</p>
            </LayoutView>
        </NotFound>
    </Router>
</CascadingAuthenticationState>
